# -*- coding: utf-8 -*-
'''
	响应报文
'''
import uvicorn
from fastapi import FastAPI

app = FastAPI()


def success(msg, data=None):
    return {
        "code":200,
        "msg":msg,
        "data":data
    }

def fail(msg, data=None):
    return {
        "code":500,
        "msg":msg,
        "data":data
    }

@app.get("/test")
def test():
    # return success("操作成功")
    return fail("错误")

if __name__ == '__main__':

    uvicorn.run(
        app     = 'example08-响应报文:app', 
        host    = "0.0.0.0", 
        port    = 8080, 
        reload  = True
    )